<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<title>${name_china}管理列表</title>
<%@include file="/common/headmy.jsp" %>

<!-- 时间日期插件 -->
<link href="<%=request.getContextPath()%>/static/plugin/My97DatePicker/skin/default/datepicker.css" rel="stylesheet" >
<script src="<%=request.getContextPath()%>/static/plugin/My97DatePicker/WdatePicker.js"></script>

</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
        </div>
    </div>
    <div class="page-title-border"></div>
</div>

<div id="t-wrap">
    <table class="summer-datagrid" id="dataList">
	    <col width="20%">
	    <col width="20%">
	    <col width="20%">
	    <col width="20%">
	    <col width="20%">
	    <thead>
		    <tr>
		        <th>当前用户</th>
		        <th>收益来源</th>
		        <th>收益金额</th>
				<th>分销级别</th>
				<th>收益时间</th>
		    </tr>
	    </thead>
    </table>
</div>

<script>
	//请求url
	var CONST_URL = {
		LIST: basePath + '${common_url}initList?id=${id}&account=${account}',
	};
	
    var  permission = CommonUtil.getPermission('${name_english}');
    //alert(JSON.stringify(permission));
    $(function () {
    	
        // 新建toobar
		$.funcbar({
			id: 'toolbar',
			type: 'toolbar',
			data: permission,
			permit: ['${name_english}:initAdd','${name_english}:exp','${name_english}:dynaExp','${name_english}:initImp','${name_english}:wordExp'],
		});
		createTable();
        
    });
    
    // 重新加载表格
	function reloadTable() {
    	//alert($('#category').combobox('getValue'));
		$('#dataList').datagrid('reload',{
            ajax: {
            	param: {
            		"account": trimSpace($('#account').val()),
            		"categoryId":$('#categoryId').combobox('getValue'),
            		"examResult":$('#examResult').combobox('getValue')
                	//"startTime": trimSpace($('#startTime').val()),
                	//"stopTime": trimSpace($('#stopTime').val())
            	}
            }
        });
	}
    
    //创建表格
    function createTable() {
    	$('#dataList').datagrid({
    		ajax: {
    			url: CONST_URL.LIST,
    			param: {
            	}
    		},
    		columns: [
    		     {
    		    	 field: 'id',
    		    	 hidden: true
    		     },
    		     {
    		    	 field: 'account'
    		     },
    		     {
    		    	 field: 'revenueSources'
    		     },
    		     {
    		    	 field: 'income',
    		    	 render: function(rowData){
    		    		 return rowData.income+"元";
    		    	 }
    		     },
    		     {
    		    	 field: 'level',
    		    	 render: function (rowData) {
    		    		 if(rowData.level=="001"){
    		    			 return "一级分销";
    		    		 }else if(rowData.level=="002"){
    		    			 return "二级分销";
    		    		 }else if(rowData.level=="003"){
    		    			 return "三级分销";
    		    		 }else{
    		    			 return "未知来源";
    		    		 }
    		    	 }
    		     },
    		     {
    		    	 field: 'ctime',
    		    	 render: function (rowData) {
    		    		 return rowData.ctime;
    		    	 }
    		     }
    	    ]
    	});
    }
    
    
   
   
</script>
</body>
</html>